package com.gitee.wsl.text.dictomaton

/**
 * Finite state dictionary interface. A dictionary provides the following
 * functionality:
 *
 *  * Check whether a character sequence is in a dictionary.
 *  * Iterate over the character sequences in the dictionary.
 *  * Get a Graphviz dot representation of the underlying automaton.
 *
 *
 * @author Daniel de Kok
 */
interface Dictionary : Set<String> {
    /**
     * Give the Graphviz dot representation of this automaton.
     *
     * @return Dot representation of the automaton.
     */
    fun toDot(): String

    /**
     * Returns <tt>true</tt> if the state is a final state and <tt>false</tt> otherwise.
     * @param state The state.
     * @return Finalness of the state.
     */
    fun isFinalState(state: Int): Boolean

    /**
     * Get the next state, given a character.
     *
     * @param state
     * @param c
     * @return
     */
    fun next(state: Int, c: Char): Int

    /**
     * Get the start state.
     *
     * @return The start state.
     */
    fun startState(): Int

    /**
     * Get the transition characters on outgoing transitions of the current state.
     *
     * @param state
     * @return
     */
    fun transitionCharacters(state: Int): Set<Char>
}
